<template>
  <el-dialog
    append-to-body
    :title="title"
    center
    :visible.sync="openState"
    width="1024px"
    :close-on-click-modal="false"
  >
    <el-form ref="queryDetail" :model="form" label-width="110px" :disabled="true">
      <!--交易础信息-->
      <el-card class="form-card">
        <div slot="header" class="label-header-msg">
          <span>交易基础信息</span>
        </div>
        <el-row>
          <el-col :span="8">
            <el-form-item label="交易流水号" prop="id">
              <el-input v-model="form.id" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="行内流水号" prop="internalId1">
              <el-input v-model="form.internalId1" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="包批次号" prop="btId">
              <el-input v-model="form.btId" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="报文标识号" prop="pkgId">
              <el-input v-model="form.pkgId" />
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="明细标识号" prop="dtlNo">
              <el-input v-model="form.dtlNo" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="CPG日期" prop="vdate">
              <el-date-picker v-model="form.vdate" style="width: 100%" type="date" value-format="yyyyMMdd" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="工作日期" prop="workdate">
              <el-date-picker v-model="form.workdate" style="width: 100%" type="date" value-format="yyyyMMdd" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="记账标识" prop="cbflag">
              <el-select style="width: 100%" v-model="form.cbflag" placeholder="记账标识">
                <el-option
                  v-for="dict in dictMap.CBFLAG"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="交易渠道" prop="source">
              <el-select style="width: 100%" v-model="form.source" placeholder="柜面交易">
                <el-option
                  v-for="dict in dictMap.TXN_SOURCE"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="业务类型" prop="bizTypeCode">
              <el-select
                style="width: 100%"
                v-model="
                  form.bizTypeCode === null || form.bizTypeCode === undefined
                    ? ''
                    : form.bizTypeCode + '-' + form.bizTypeCodeDesc
                "
                placeholder="业务类型"
                :disabled="true"
              ></el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="业务种类" prop="bizCtgyCode">
              <el-select
                style="width: 100%"
                v-model="
                  form.bizCtgyCode === null || form.bizCtgyCode === undefined
                    ? ''
                    : form.bizCtgyCode + '-' + form.bizCtgyCodeDesc
                "
                placeholder="业务种类"
                :disabled="true"
              ></el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="金额" prop="amount">
              <ht-amount-input v-model="form.amount" placeholder="交易金额" style="width: 195px"></ht-amount-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="大写金额" prop="bAmount">
              <ht-amount-upper :inputValue="form.amount" placeholder="交易金额" style="width: 195px"></ht-amount-upper>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label="附言" prop="remark">
                <el-input type="textarea" v-model="form.remark" />
              </el-form-item>
            </el-col>
          </el-row>
        </el-row>
      </el-card>

      <!--付款人信息-->
      <el-card class="form-card">
        <div slot="header" class="label-header-msg">
          <span>付款人信息</span>
        </div>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="付款人账号" prop="payerActno">
              <el-input v-model="form.payerActno" placeholder="付款人账号" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="付款行行号" prop="payerBrno">
              <el-input v-model="form.payerBrno" placeholder="付款行行号" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-form-item label="付款人名称" prop="payerName">
            <el-input v-model="form.payerName" placeholder="付款人名称" />
          </el-form-item>
        </el-row>
        <el-row>
          <el-form-item label="付款人地址" prop="payerAddr">
            <el-input v-model="form.payerAddr" placeholder="付款人地址" />
          </el-form-item>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="8">
            <div class="grid-payer">
              <el-form-item label="付款人开户行号" prop="payerAccBrno">
                <el-input v-model="form.payerAccBrno" placeholder="付款人开户行行号" />
              </el-form-item>
            </div>
          </el-col>
          <el-col :span="16">
            <el-form-item label="付款人开户行行名" prop="payerAccBrname" label-width="130px">
              <el-input v-model="form.payerAccBrname" placeholder="付款人开户行行名" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>

      <!--收款人信息-->
      <el-card class="form-card">
        <div slot="header" class="label-header-msg">
          <span>收款人信息</span>
        </div>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="收款人账号" prop="payeeActno">
              <el-input v-model="form.payeeActno" placeholder="收款人账号" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="收款行行号" prop="payeeBrno">
              <el-input v-model="form.payeeBrno" placeholder="收款行行号" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="收款人名称" prop="payeeName">
          <el-input v-model="form.payeeName" placeholder="收款人名称" />
        </el-form-item>
        <el-form-item label="收款人地址" prop="payeeAddr">
          <el-input v-model="form.payeeAddr" placeholder="收款人地址" />
        </el-form-item>
        <el-row :gutter="10"></el-row>
        <el-row :gutter="10">
          <el-col :span="8">
            <div class="grid-payee">
              <el-form-item label="收款人开户行号" prop="payeeAccBrno">
                <el-input v-model="form.payeeAccBrno" placeholder="收款人开户行行号" />
              </el-form-item>
            </div>
          </el-col>
          <el-col :span="16">
            <el-form-item label="收款人开户行行名" prop="payeeAccBrname" label-width="130px">
              <el-input v-model="form.payeeAccBrname" placeholder="收款人开户行行名" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>

      <el-card class="form-card" v-show="this.form.bizTypeCode === 'A104'">
        <div slot="header" class="label-header-msg">
          <span>国库资金国债兑付贷记划拨附加数据</span>
        </div>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="信息流水号" prop="flownb">
              <el-input v-model="form.flownb" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="上报国库代码" prop="reportCode" label-width="110px">
              <el-input v-model="form.reportCode" placeholder="上报国库代码" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="接收国库代码" prop="receiveCode" label-width="110px">
              <el-input v-model="form.receiveCode" placeholder="接收国库代码" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="报表日期" prop="reprotDate" label-width="110px">
              <el-date-picker
                v-model="form.reprotDate"
                type="date"
                placeholder="报表日期"
                style="width: 100%"
                value-format="yyyyMMdd"
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="预算级次" prop="budgetLevel">
              <el-select style="width: 100%" v-model="form.budgetLevel" placeholder="预算级次">
                <el-option
                  v-for="dict in dictMap.BUDGETLEVELCODE"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="预算种类" prop="budgetType">
              <el-select style="width: 100%" v-model="form.budgetType" placeholder="预算种类">
                <el-option
                  v-for="dict in dictMap.BUDGETTYPECODE"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12">
            <el-form-item label="调整期标志" prop="indicatorCode">
              <el-select style="width: 100%" v-model="form.indicatorCode" placeholder="调整期标志">
                <el-option
                  v-for="dict in dictMap.INDICATOR_CODE"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="明细条数" prop="dtlNum">
              <el-input v-model="form.dtlNum" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12">
            <el-form-item label="明细汇总币种" prop="dtlCurcd">
              <el-input v-model="form.dtlCurcd" :disabled="true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="明细汇总金额" prop="dtlAmount">
              <ht-amount-input v-model="form.dtlAmount" placeholder="明细汇总金额" :disable="true"></ht-amount-input>
            </el-form-item>
          </el-col>
        </el-row>

        <ht-table
          ref="dataTableA104"
          :showSerialNumber="false"
          :multi-select="false"
          :reqConfig="reqConfigA104"
          :queryParams="queryParams"
          :tableBindColumns="tableBindColumnsA104"
          :showRightToolbar="false"
          :initData="false"
          :randomRowKey="true"
        ></ht-table>
      </el-card>

      <el-card class="form-card" v-show="this.form.bizTypeCode === 'A307'">
        <div slot="header" class="label-header-msg">
          <span>国库资金国债兑付贷记划拨附加数据</span>
        </div>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="信息流水号" prop="infNumber">
              <el-input v-model="form.infNumber" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <div class="grid-payAddInfo">
              <el-form-item label="上报国库代码" prop="reportCode" label-width="110px">
                <el-input v-model="form.reportCode" placeholder="票据号码" />
              </el-form-item>
            </div>
          </el-col>
          <el-col :span="12">
            <div class="grid-payAddInfo">
              <el-form-item label="接收国库代码" prop="receiveCode" label-width="110px">
                <el-input v-model="form.receiveCode" placeholder="票据号码" />
              </el-form-item>
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <div class="grid-payAddInfo">
              <el-form-item label="报表日期" prop="reportDate" label-width="110px">
                <el-date-picker
                  v-model="form.reportDate"
                  type="date"
                  placeholder="选择日期"
                  style="width: 100%"
                  value-format="yyyyMMdd"
                ></el-date-picker>
              </el-form-item>
            </div>
          </el-col>
          <el-col :span="12">
            <el-form-item label="报表序号" prop="reportNumber" label-width="110px">
              <el-input v-model="form.reportNumber" placeholder="票据号码" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <div class="grid-payAddInfo">
              <el-form-item label="明细条数" prop="dtlCount" label-width="110px">
                <el-input v-model="form.dtlCount" placeholder="明细条数" disabled />
              </el-form-item>
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <div class="grid-payAddInfo">
              <el-form-item label="明细汇总金额币种" prop="dtlCurcd" label-width="110px">
                <el-input v-model="form.dtlCurcd" placeholder="明细汇总金额币种" disabled />
              </el-form-item>
            </div>
          </el-col>
          <el-col :span="12">
            <div class="grid-payAddInfo">
              <el-form-item label="明细汇总金额" prop="dtlNum" label-width="110px">
                <el-input v-model="form.dtlNum" placeholder="明细汇总金额" disabled />
              </el-form-item>
            </div>
          </el-col>
        </el-row>
        <ht-table
          ref="dataTableA307"
          :showSerialNumber="false"
          :multi-select="false"
          :reqConfig="reqConfigA307"
          :queryParams="queryParams"
          :tableBindColumns="tableBindColumnsA307"
          :showRightToolbar="false"
          :initData="false"
          :randomRowKey="true"
        ></ht-table>
      </el-card>

      <el-card class="form-card">
        <div slot="header" class="label-header-msg">
          <span>其他信息</span>
        </div>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="通讯状态" prop="status">
              <el-select style="width: 100%" v-model="form.status" placeholder="通讯状态">
                <el-option
                  v-for="dict in dictMap.PKG_STATUS"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="中心状态" prop="procStatus">
              <el-select style="width: 100%" v-model="form.procStatus" placeholder="中心状态">
                <el-option
                  v-for="dict in dictMap.PROCESSSTATUS"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12">
            <el-form-item label="业务处理码" prop="procCode">
              <el-select
                style="width: 100%"
                v-model="
                  form.procCode === null || form.procCode === undefined ? '' : form.procCode + '-' + form.procCodeDesc
                "
                placeholder="业务拒绝处理码"
                :disabled="true"
              ></el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="24">
            <el-form-item label="业务拒绝信息" prop="rejectInfo">
              <el-input type="textarea" v-model="form.rejectInfo" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12">
            <el-form-item label="录入操作员" prop="mdTlrno">
              <el-input v-model="form.mdTlrno" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="录入时间" prop="mdTime">
              <el-date-picker
                style="width: 100%"
                v-model="form.mdTime"
                value-format="yyyyMMddHHmmss"
                type="datetime"
                :disabled="true"
              />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12">
            <el-form-item label="复核操作员" prop="ckTlrno">
              <el-input v-model="form.ckTlrno" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="复核时间" prop="ckTime">
              <el-date-picker
                style="width: 100%"
                v-model="form.ckTime"
                value-format="yyyyMMddHHmmss"
                type="datetime"
                :disabled="true"
              />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="24">
            <el-form-item label="复核附言" prop="ckRemarks">
              <el-input type="textarea" v-model="form.ckRemarks" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12">
            <el-form-item label="审核操作员" prop="audTlrno">
              <el-input v-model="form.audTlrno" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="审核时间" prop="audTime">
              <el-date-picker
                style="width: 100%"
                v-model="form.audTime"
                value-format="yyyyMMddHHmmss"
                type="datetime"
                :disabled="true"
              />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="24">
            <el-form-item label="审核附言" prop="audRemarks">
              <el-input type="textarea" v-model="form.audRemarks" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="handleClose">关闭</el-button>
    </div>
  </el-dialog>
</template>
<script>
import { ddetail, reqConfigA104, reqConfigA307 } from "@/api/cnaps/baseBiz/inquire/batch/index";
import HtAmountInput from "@/views/components/HtAmountInput";
import HtAmountUpper from "@/views/components/HtAmountUpper";

export default {
  name: "detail6410",
  components: {
    HtAmountInput,
    HtAmountUpper,
  },
  props: {
    dictMap: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      busTypeList: [],
      id: "",
      pkgNo: "",
      title: "",
      // 是否显示弹出层
      openState: false,
      reqConfigA104: reqConfigA104,

      reqConfigA307: reqConfigA307,
      queryParams: {
        id: "",
      },
      tableBindColumnsA307: [
        { prop: "debtBankType", label: "兑付国债银行大类", dictCode: "DEBT_BANK_TYPE" },
        { prop: "capitalCode", label: "本金代码" },
        { prop: "capitalAmount", label: "本金金额", type: "price" },
        { prop: "accrualCode", label: "利息代码" },
        { prop: "accrualAmount", label: "利息金额", type: "price" },
      ],
      tableBindColumnsA104: [
        {
          label: `征收机关大类代码`,
          prop: "deptCode",
          dictCode: "DEPT_CODE",
        },
        { label: `预算科目代码`, prop: "subjectCode" },
        {
          label: `发生额`,
          prop: "amount",
          type: "price",
        },
      ],
      // 表单参数
      form: {
        amount: "0.00",
      },
    };
  },
  mounted() {},
  methods: {
    // 关闭回掉
    handleClose() {
      this.openState = false;
    },
    show(id, pkgNo) {
      this.openState = true;
      if (id) {
        this.title = "小额批量打包明细明细";
        ddetail({
          id: id,
          pkgNo: pkgNo,
        }).then((res) => {
          this.$set(this, "form", res.result);
          this.$set(this.queryParams, "id", this.form.id);
          this.$nextTick(() => {
            if (this.form.bizTypeCode === "A307") {
              this.$refs.dataTableA307.doQuery(true);
            } else if (this.form.bizTypeCode === "A104") {
              this.$refs.dataTableA104.doQuery(true);
            }
          });
        });
      }
    },

    cancel() {
      this.openState = false;
    },
  },
};
</script>
<style>
.label-header-msg {
  font-weight: bold;
}

.form-card {
  margin-bottom: 10px;
}
</style>
